
if ( CLIENT ) then
	SWEP.Author				= "CSE - Night-Eagle"
	SWEP.Contact			= "gmail sedhdi"
	SWEP.Purpose			= ""
	SWEP.Instructions		= ""
	SWEP.PrintName			= "CSE Beretta"
	SWEP.Instructions		= ""
	SWEP.Slot				= 1
	SWEP.SlotPos			= 0
	SWEP.IconLetter			= "y"
	
	SWEP.ViewModelFlip		= false
	
	killicon.AddFont("cse_beretta","CSKillIcons",SWEP.IconLetter,Color(255,80,0,255))
end

if ( SERVER ) then
	AddCSLuaFile( "shared.lua" )
end


SWEP.Base				= "cse_base_s"

SWEP.Spawnable			= true
SWEP.AdminSpawnable		= true

SWEP.ViewModel			= "models/weapons/v_pist_elite.mdl"
//SWEP.WorldModel			= "models/weapons/w_pist_elite_single.mdl" --Crotch model
SWEP.WorldModel			= "models/weapons/w_pist_p228.mdl"
SWEP.HoldType = "pistol"

SWEP.Weight				= 5
SWEP.AutoSwitchTo		= false
SWEP.AutoSwitchFrom		= false

SWEP.Primary.Sound			= Sound("Weapon_ELITE.Single")
SWEP.Primary.Recoil			= 2
SWEP.Primary.Unrecoil		= 7
SWEP.Primary.Damage			= 14
SWEP.Primary.NumShots		= 1
SWEP.Primary.Cone			= 0
SWEP.Primary.ClipSize		= 16
SWEP.Primary.Delay			= 0.06 //Don't use this, use the tables below!
SWEP.Primary.DefaultClip	= 62 //Always set this 1 higher than what you want.
SWEP.Primary.Automatic		= true //Don't use this, use the tables below!
SWEP.Primary.Ammo			= "smg1"

SWEP.Secondary.ClipSize		= -1
SWEP.Secondary.DefaultClip	= -1
SWEP.Secondary.Automatic	= false
SWEP.Secondary.Ammo			= "none"

//Firemode configuration

SWEP.IronSightsPos = Vector(-4,-2.5,-2)
SWEP.IronSightsAng = Vector(-.1,2,-60)
SWEP.IronSightsPosNo = Vector(-4,-2.5,-2)
SWEP.IronSightsAngNo = Vector(-.1,2,-60)
SWEP.IronSightsPosZoom = Vector(-4.94,-2,2.93)
SWEP.IronSightsAngZoom = Vector(-.1,.07,-1)

SWEP.data = {}
SWEP.mode = "semi" //The starting firemode
SWEP.data.newclip = false //Do not change this



SWEP.data.semi = {}
SWEP.data.semi.Delay = .09
SWEP.data.semi.Cone = 0.011
SWEP.data.semi.ConeZoom = 0.008

//End of configuration

function SWEP:Deploy()
	self:SetIronsights(true)
	if SERVER then
		if self.mode == "auto" then
			self.Weapon:SetNetworkedInt("csef",1)
		elseif self.mode == "burst" then
			self.Weapon:SetNetworkedInt("csef",2)
		elseif self.mode == "semi" then
			self.Weapon:SetNetworkedInt("csef",3)
		end
	end
	self.data[self.mode].Init(self)
	return true
end

function SWEP:Reload()
	if SERVER and self.Owner:GetFOV() ~= 90 then
		self.Owner:SetFOV(90,.3)
		self.IronSightsPos = self.IronSightsPosNo
		self.IronSightsAng = self.IronSightsAngNo
	else
		self.IronSightsPos = self.IronSightsPosNo
		self.IronSightsAng = self.IronSightsAngNo
	end
	
	self.data.oldclip = self.Weapon:Clip1()
	
	self.Weapon:DefaultReload(ACT_VM_RELOAD)
	self.data.newclip = 1
end

function SWEP:ShootEffects()
	self.Weapon:SendWeaponAnim(ACT_VM_SECONDARYATTACK)
	
	self.Owner:MuzzleFlash()
	self.Owner:SetAnimation( PLAYER_ATTACK1 )
end

function SWEP:SecondaryAttack()
	if self.Owner:KeyDown(IN_USE) then
		self.data[self.mode].Init(self)
	elseif SERVER then
		if self.Owner:GetFOV() == 90 then
			self.Owner:SetFOV(self.data.zoomfov,0)
			self.IronSightsPos = self.IronSightsPosZoom
			self.IronSightsAng = self.IronSightsAngZoom
		else
			self.Owner:SetFOV(90,.3)
			self.IronSightsPos = self.IronSightsPosNo
			self.IronSightsAng = self.IronSightsAngNo
		end
	else
		if self.Owner:GetFOV() == 90 then
			self.IronSightsPos = self.IronSightsPosZoom
			self.IronSightsAng = self.IronSightsAngZoom
		else
			self.IronSightsPos = self.IronSightsPosNo
			self.IronSightsAng = self.IronSightsAngNo
		end
	end
end
